package biznussoft.metercor.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import biznussoft.metercor.R;
import biznussoft.metercor.model.InventoryModel;



public class InventoryMasterAdapter extends BaseAdapter {
	
	ArrayList<InventoryModel> listdata;
	Context mContext;

	public InventoryMasterAdapter(Context context, ArrayList<InventoryModel> list) {
		// TODO Auto-generated constructor stub
		this.listdata = list;
		this.mContext = context;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return listdata.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	public class ViewHolder{
		public TextView name;
		public TextView phno;
		public TextView billingCity;
//		public ImageView image;
	}

	public View getView(int position, View v, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		ViewHolder holder;
		
		if(v == null){
			
			holder = new ViewHolder();
			LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = inflator.inflate(R.layout.common_details_page, null);
			holder.name  = (TextView) v.findViewById(R.id.text1);
			holder.billingCity  = (TextView) v.findViewById(R.id.text2);
			holder.phno = (TextView) v.findViewById(R.id.text3);
//			holder.image = (ImageView) v.findViewById(R.id.imageview);
			
			v.setTag(holder);
		}else{
			holder = (ViewHolder) v.getTag();
		}
		
		InventoryModel bean = listdata.get(position);
		
			holder.name.setText(bean.getName());
//			holder.billingCity.setText(bean.getDescription());
//			holder.phno.setText(bean.getGeoLocation());
//			holder.image.setImageResource(R.drawable.inventory);
		
		return v;
	}

}
